package com.txy.test.domain;

import com.txy.domain.strategy.service.armory.IStrategyArmory;
import com.txy.domain.strategy.service.armory.IStrategyDispatch;
import com.txy.domain.strategy.service.armory.StrategyArmoryDispatch;
import lombok.extern.slf4j.Slf4j;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;

@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class StrategyArmoryDispatchTest {
    @Resource
    private StrategyArmoryDispatch strategyArmoryDispatch;
    @Resource
    private IStrategyArmory strategyArmory;

    @Resource
    private IStrategyDispatch strategyDispatch;

    @Before
    public void test_assembleLotteryStrategy() {
        strategyArmory.assembleLotteryStrategy(100001L);
    }

    @Test
    public void test_getRandomAwardId() {
        log.info("测试结果, 奖品ID: {}", strategyDispatch.getRandomAwardId(100001L));
    }

    @Test
    public void test_getRandomAwardId_weightRuleValue() {
        log.info("测试结果, 奖品ID: {}", strategyArmoryDispatch.getRandomAwardId(100001L, "4000:102,103,104,105"));
        log.info("测试结果, 奖品ID: {}", strategyArmoryDispatch.getRandomAwardId(100001L, "5000:102,103,104,105,106,107"));
        log.info("测试结果, 奖品ID: {}", strategyArmoryDispatch.getRandomAwardId(100001L, "6000:102,103,104,105,106,107,108,109"));
    }


}
